package util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBUtil {
	static String url="jdbc:mysql://localhost:3306/day0302?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai";
	static String user="root";
	static String pass="123456";
	
	
	public static Connection getConn(){
		//  ȡһ      
		Connection conn=null;
				try {
					//        
					Class.forName("com.mysql.cj.jdbc.Driver");
					conn = DriverManager.getConnection(url, user, pass);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return conn;
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println(DBUtil.getConn());
	}

}
